package com.summer.service.role;

import com.summer.dao.BaseDao;
import com.summer.dao.role.RoleDao;
import com.summer.dao.role.RoleDaoImpl;
import com.summer.pojo.Role;

import java.sql.Connection;
import java.util.ArrayList;
import java.util.List;

/**
 * 作者:夏天
 * qq:1205232048
 */
public class RoleServiceImpl implements RoleService{
    private RoleDao roleDao;

    public RoleServiceImpl(){
        roleDao = new RoleDaoImpl();
    }

    /**
     * 获取用户列表
     * @return
     */
    public List<Role> getRoleList() {
        Connection connection = null;
        List<Role> roles = new ArrayList<Role>();
        try {
            connection = BaseDao.getConnection();
            roles = roleDao.getRoleList(connection);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            BaseDao.closeResource(connection,null,null);
        }
        return roles;
    }
}
